package com.yshy.moviechoseseatingcommon.enums;

import java.util.Arrays;

public enum OrderStateEnum {
    AWAIT_PAYING(0, "待付款"),
    AWAIT_TICKETING(5, "待出票"),
    GET_TICKETING(10, "已出票"),
    TRANSACTION_SUCCESS(15, "交易成功"),
    CANCELED(-5, "已取消");

    private Integer value;
    private String name;

    OrderStateEnum(Integer value, String name) {
        this.value = value;
        this.name = name;

    }

    public Integer getValue() {
        return value;
    }

    public String getName() {
        return name;
    }

    public static OrderStateEnum getOrderStateEnum(int value) {
        return Arrays.asList(values()).stream().filter((enumValue) -> enumValue.value == value).findFirst().orElse(null);
    }
}
